yo-fs
A client-side modular, stream-friendly ui browser widget for navigating directories, built with yo-yo.
api
yofs(path, entries, onclick)
path
: the directory or filename to displayentries
: a list of entries with name
, size
, modified
, createReadStream
onclick
: fires when a folder, file, or back button is clicked.
example
var yofs = require('yo-fs')
var yo = require('yo-yo')
var entries = []
function onclick (event, entry) {
console.log('i clicked', entry)
}
var el = yofs('/', entries, onclick)
document.body.appendChild(el)
function update () {
var fresh = tree.render('/', entries, onclick)
yo.update(tree.widget, fresh)
}
var stream =
stream.on('data', function (entry) {
entries.push(entry)
update()
}